#ifndef _PT_MONITOR_H__
#define _PT_MONITOR_H_

#ifdef __cplusplus
extern "C"
{
#endif

#include <config.h>
#include <sys/types.h>
#include <sys/memory.h>

#define PT_MONITOR_TIMER_PERIOD	4

typedef pt_uint16_t pt_event_id_t;
typedef pt_uint8_t pt_task_id_t;
typedef pt_uint32_t pt_wparam_t;
typedef pt_uint32_t pt_lparam_t;
typedef pt_uint32_t pt_wparam_t;
typedef pt_uint32_t pt_time_t;

struct ptgui_point;
typedef struct ptgui_event
{
	/* the event type */
	pt_event_id_t type;

	/* user field of event */
	pt_task_id_t	srcId;

	/* the event sender */
	pt_task_id_t	destId;

	pt_wparam_t wparam;		
	pt_lparam_t lparam;
} pt_event_t;

extern void pt_message_system_init(void);

extern pt_err_t pt_post_message(pt_task_id_t dest_task_id, pt_event_id_t msg_id, 
							pt_wparam_t wparam, pt_lparam_t lparam);
extern pt_err_t pt_post_time_message(pt_task_id_t dest_task_id, pt_event_id_t msg_id, 
							pt_wparam_t wparam, pt_lparam_t lparam, pt_time_t time);
extern pt_err_t pt_send_message(pt_task_id_t dest_task_id, pt_event_id_t msg_id, 
							pt_wparam_t wparam, pt_lparam_t lparam);

extern pt_err_t pt_peek_message(pt_event_t* message);
extern pt_err_t pt_translate_message(pt_event_t* message);
extern pt_err_t pt_dispatch_message(pt_event_t* message);
extern pt_err_t pt_delete_message_quick(pt_event_id_t msg_id);
extern pt_err_t pt_delete_message(pt_event_t* message);

extern void pt_tick_ISR(void);
extern void pt_exec_time_task(void);
extern pt_uint32_t pt_timer_start(void);
extern pt_uint32_t pt_timer_get_delta(void);
extern void pt_timer_sleep(pt_uint32_t time);

extern void pt_assert(const char* str, int line);
extern void pt_kprintf(const char *fmt, ...);

#ifdef __cplusplus
}
#endif		/* __cplusplus */

#endif